package Demo;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class BorderLayoutTest extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					BorderLayoutTest frame = new BorderLayoutTest();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public BorderLayoutTest() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));		
		setContentPane(contentPane);
		
		contentPane.setLayout(new BorderLayout(3, 3));
		getContentPane().setLayout(new BorderLayout());
		
		JButton but1= new JButton("anniu1");
		getContentPane().add(but1, BorderLayout.NORTH);
		
		JButton but2 = new JButton("anniu2");
		getContentPane().add(but2,BorderLayout.SOUTH);
		
		JButton but3 = new JButton("anniu3");
		getContentPane().add(but3, BorderLayout.WEST);
		
		JButton but4 = new JButton("anniu4");
		getContentPane().add(but4, BorderLayout.EAST);
		
		JPanel center = new JPanel();
		//center.setLayout(new FlowLayout(FlowLayout.CENTER,3,3) );
		center.setLayout(new GridLayout(4,2));  ///???
		for(int i=0 ;i<10; i++){
			JButton b = new JButton("center"+i);
			center.add(b);		
		}
		getContentPane().add(center, BorderLayout.CENTER);
		//this.pack();
		
	}

}
